
<?php use_helper('Object') ?>
<?php echo form_tag('user/updatesite', Array('id' => 'frmuser', 'name' => 'frmuser')) ?><?php echo input_hidden_tag('avail_site', $avail_site) ?>
<?php echo object_input_hidden_tag($tbl_site, 'getFId') ?>
<script type="text/javascript">
function formchecking() {	var isOK = 'Yes';	if (document.getElementById('f_site_no').value == '') {		alert('Please enter site no!');		return false;	} else if (document.getElementById('f_site_location').value == '') {		alert('Please enter site location!');		return false;	} else if (document.getElementById('f_display_size').value == '') {		alert('Please enter display size!');		return false;	}
	
	string_site = Trim(document.getElementById('f_site_no').value);
	arr_sites = document.getElementById('avail_site').value.split(';');
	for(x=0; x < arr_sites.length; x++) {
		if(arr_sites[x].toUpperCase()==string_site.toUpperCase()){
			alert('Site no already exist!');
			document.getElementById('f_site_no').value = '';
			document.getElementById('f_site_no').focus();
			return false;
		}
	}	
	document.getElementById('frmuser').submit();
}
</script>
<table width='100%' align=center>
	<tr>
    	<td valign="middle" align="center">
        <form name="myForm">        	
   	    <table>
            	<tr>
                	<td align="left" colspan="3" class="popTitle">
                	<?php if ($tbl_site->getFId() == NULL) echo "Create New Site"; else echo "Edit Site"; ?>
                	</td>
                </tr>
                <tr>
                	<td align="left">Site No</td>
                    <td align="left">:</td>
                    <td align="left">
                    <?php if ($tbl_site->getFId() == NULL) { ?>
					  <?php echo object_input_tag($tbl_site, 'getFSiteNo', array ('size' => 30)) ?>
					<?php } else { ?>
					  <?php echo $tbl_site->getFSiteNo(); ?>
					  <?php echo input_hidden_tag('f_site_no', $tbl_site->getFSiteNo()); ?>
					<?php } ?>
                    </td>
                </tr>
                <tr>
                	<td align="left">Site Location</td>
                    <td align="left">:</td>
                    <td align="left"><?php echo object_input_tag($tbl_site, 'getFSiteLocation', array ('size' => 60)) ?></td>
                </tr>
          		<tr>
                	<td align="left" valign="top">Display Size</td>
               		<td align="left" valign="top">:</td>
            		<td align="left"><?php echo object_input_tag($tbl_site, 'getFDisplaySize', array ('size' => 30)) ?></td>
       		 	</tr>
            </table>
            </form>
        </td>
    </tr>
    <tr>
    	<td valign="middle" align="center">
    		<img name="btnCancel" id="btnCancel" onmouseover="roll_over('btnCancel', '/images/cancel_btnAF.jpg')" onmouseout="roll_over('btnCancel', '/images/cancel_btn.jpg')" src="/images/cancel_btn.jpg" onClick="location.href='/user/sitelist'"/>&nbsp;&nbsp;&nbsp;
    		<img name="btnSave" id="btnSave" onmouseover="roll_over('btnSave', '/images/<?php if ($tbl_site->getFId() == NULL) echo "create_btnAF.jpg"; else echo "update_btnAF.jpg"; ?>')" onmouseout="roll_over('btnSave', '/images/<?php if ($tbl_site->getFId() == NULL) echo "create_btn.jpg"; else echo "update_btn.jpg"; ?>')" src="/images/<?php if ($tbl_site->getFId() == NULL) echo "create_btn.jpg"; else echo "update_btn.jpg"; ?>" onClick="return formchecking()"/>
    	</td>
    </tr>
</table>

</form>
